package stringdemo;

public class StringDemo9 {
    public static void main(String[] args) {
        String id = "522427200302159714";

        String year = id.substring(6, 10);
        String month = id.substring(10, 12);
        String day = id.substring(12, 14);

        char gender = id.charAt(16);

        int num = gender - 48;
        if(num % 2 != 0){
            System.out.println("性别为：男");
        }else{
            System.out.println("性别为：女");
        }

        String result = year + "年" + month + "月" + day + "日";
        System.out.println("出生年月日：" + result);
    }
}
